﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Citi.HeadCount.Domain;
using System.ComponentModel.DataAnnotations;

namespace Citi.HeadCount.WebUI.Models
{
    public class TypeRuleResultViewModel
    {   
        [Display(Name = "Type: ")]
        public int TypeResultId { get; set; }
        [Display(Name = "Type: ")]
        public int RuleResultId { get; set; }
        public bool Active { get; set; }

        public string TypeResult { get; set; }
        public string TypeResultValue { get; set; }

        public static TypeRuleResultViewModel CreateModel(TypeRuleResult domain)
        {
            return new TypeRuleResultViewModel
                {
                    RuleResultId = domain.RuleResultId,
                    TypeResultId = domain.TypeResultId,
                    TypeResult = domain.TypeResult.Type.GetDescription(),
                    TypeResultValue = domain.TypeResult.Value
                };
        }

        public static IEnumerable<TypeRuleResultViewModel> CreateModel(IEnumerable<TypeRuleResult> domains)
        {
            return domains.Select(CreateModel).ToList();
        }
    }
}